package com.settlement.system.converter;

import com.alibaba.excel.converters.integer.IntegerStringConverter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.CellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.settlement.system.common.constant.Number;

/**
 * 订单稽核 是否稽核转化
 *
 * @author Ximi
 * @since 2020/12/15
 */
public class OrderIsAduitConverter extends IntegerStringConverter {

    @Override
    public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        if (value != null) {
            if (value == Number.ZERO || value == Number.TWO) {
                return new WriteCellData("否");
            } else if (value == Number.ONE || value == Number.THREE) {
                return new WriteCellData("是");
            }
        }
        return super.convertToExcelData(value, contentProperty, globalConfiguration);
    }
}
